--- a/amavisd.orig	2008-06-12 12:28:13.000000000 +0200
+++ b/amavisd-new-2.6	2008-06-12 12:36:52.000000000 +0200
@@ -338,7 +338,8 @@
       %hdrfrom_notify_release_by_ccat %hdrfrom_notify_report_by_ccat
       %admin_maps_by_ccat %warnrecip_maps_by_ccat
       %always_bcc_by_ccat %dsn_bcc_by_ccat
-      %addr_extension_maps_by_ccat %addr_rewrite_maps_by_ccat
+      %addr_extension_maps_by_ccat %addr_rewrite_maps_by_ccat 
+      %recipient_policy_bank_map %recipient_policy_bank_re_map
     )],
     'confvars' =>  # global settings (not per-policy, not per-recipient)
     [qw(
@@ -372,6 +373,7 @@
       %banned_rules $penpals_threshold_low $penpals_threshold_high
       $enable_dkim_verification $enable_dkim_signing %dkim_signing_keys
       $file $altermime $enable_anomy_sanitizer
+      %recipient_policy_bank_map %recipient_policy_bank_re_map
     )],
     'sa' =>  # global SpamAssassin settings
     [qw(
@@ -15481,6 +15483,26 @@
           $recip_obj->dsn_orcpt($orcpt)    if defined $orcpt;
           push(@recips,$recip_obj);
           $msg = "250 2.1.5 Recipient $addr OK";
+	  my ($user, $domain) = split('@', $addr);
+	  if (defined $recipient_policy_bank_map{$addr}) {
+		  Amavis::load_policy_bank($recipient_policy_bank_map{$addr});
+		  do_log(1, sprintf("Policy bank '%s' taken for recp '%s'",
+				  $recipient_policy_bank_map{$addr},
+				  $addr));
+	  } elsif (defined $recipient_policy_bank_map{$domain}) {
+		  Amavis::load_policy_bank($recipient_policy_bank_map{$domain});
+		  do_log(1, sprintf("Policy bank '%s' taken for recp '%s'",
+				  $recipient_policy_bank_map{$domain},
+				  $addr));
+	  }
+	  foreach my $recipient_re (keys(%recipient_policy_bank_re_map)) {
+		  if ($addr =~ /$recipient_re/) {
+			  Amavis::load_policy_bank($recipient_policy_bank_re_map{$recipient_re});
+			  do_log(1, sprintf("Policy bank '%s' taken for recp '%s'",
+					  $recipient_policy_bank_re_map{$domain},
+					  $addr));
+		  }
+	  }
         }
         $self->smtp_resp(0,$msg, !$msg_nopenalize && $msg=~/^5/ ? 1 : 0, $cmd);
         last;
